package org.jackysoft.report.visitor;

import org.jackysoft.entity.ArmItem;
import org.jackysoft.report.ItemUnit;
import org.jackysoft.report.DataItemType;
import org.jackysoft.report.ReportConstant;
import org.springframework.stereotype.Component;

/**
 * 月半成品统计访问者<br/>
 * 主要用来计算每个产品各项统计数据
 * */
@Component(ReportConstant.MonthlySemiManufacturedProductVisitor)
public class ArmMonthlySemiManufacturedAccumulativeVisitor extends
		AbstractArmItemVisitor {
	
	
	public ArmMonthlySemiManufacturedAccumulativeVisitor() {
		super();
		// TODO Auto-generated constructor stub
	}

	public ArmMonthlySemiManufacturedAccumulativeVisitor(ArmItem source) {
		super(source);
	}

	@Override
	public void visite(ItemUnit item) {
		if (getSource() == null){
			this.setSource(new ArmItem());
		}
		ArmItem source = this.getSource();
		ArmItem target = (ArmItem) item;	    	
		DataItemType[] dts = {
				DataItemType.LocalIn,
				DataItemType.LocalOut,
		        DataItemType.Waster,
		        DataItemType.Increment
		};
		for(DataItemType dt:dts) accumulate(dt,source,target);
	    
	}
	
	

	
}
